String that specifies the characters that are allowed or not allowed in the field.
Syntax
HTML |
<ELEMENT id=elementID fieldType=sType filter=sFilter...>...</ELEMENT> |
Scripting |
elementID.filter [ =sFilter ] |
Parameters
Parameter |
Description |
sFilter |
String that denotes the filter that is set on the field, to allow or disallow a set of characters. |
Thefilterattribute set for any field should follow the regular expression syntax properly. Following are the standard filters that can be set for certain field types.
date |
[\w +-/|] |
floats and amounts |
[0-9.,+-]. For this case,signedshould be true. |
integer |
[0-9+-]. For this case,signedshould be true. |
Example
The following example shows how the filter property can be used.
//validate definition inside the BODY
<div cordysType="wcp.library.util.Validate" id="validate" ></div>
//Restrict entering even numbers and permit only odd numbers
<input type="text" fieldType="integer" filter="[^24680]">
//Restrict entering special characters like ~, !, @, #, $, % etc.,
<input type="text" fieldType="text" filter="[^;'~!@#$%^&*]">
//The filter above can also be replaced with this filter
<input type="text" fieldType="text" filter="[A-Za-z0-9 .,]">
See Also
validate, signed